/**
 * 
 */
package com.asohofrucol.service.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.asohofrucol.dao.UserDao;
import com.asohofrucol.dto.UserDTO;
import com.asohofrucol.dto.util.UserHelperDto;
import com.asohofrucol.exception.InvalidUserException;
import com.asohofrucol.model.User;
import com.asohofrucol.service.UserService;

/**
 * @author Geovanni
 * 
 */
@Component
public class UserServiceImpl implements UserService, Serializable {

	private static final long serialVersionUID = 1L;

	@Autowired
	UserDao userDao;

	public UserServiceImpl() {
		System.out.println("UserServiceImpl");
	}

	@Override
	public UserDTO findOne(Long id) {
		User user = userDao.findOne(id);
		UserDTO userDTO = new UserDTO();
		userDTO = UserHelperDto.convertToDto(user);
		return userDTO;

	}

	@Override
	public UserDTO findByUserName(String userName) {
		User user = userDao.findByUserName(userName);
		UserDTO userDTO = new UserDTO();
		userDTO = UserHelperDto.convertToDto(user);
		return userDTO;
	}

	public UserDTO saveUser(UserDTO userDto) throws InvalidUserException {
		// userDao.save(user);
		// userDto.setId(user.getId());
		System.out.println("saveUser ejecutandose");
		return userDto;
	}

	public List<UserDTO> listUser() {
		// TODO Auto-generated method stub
		return null;
	}

}
